<?php

class Control_Model_Table_Services extends Zend_Db_Table_Abstract
{
    protected $_name = 'services_content';
    
    public function getServices()
    {   $val = 'copyright';
        $select = $this->select();
        $select->order('id DESC')
               ->limit('1');
        $services = $this->_db->query($select)->fetchAll();
        $services = $services['0'];
        return $services;
    }

        public function getDataID($id)
    {
        $id = (int)$id;
        $row = $this->fetchRow('id ='.$id);
        if (!$row) {
 //           throw new Exception("Count not find row $id");
        }else{return $row->toArray();}
    }

    public function getAll()
    {
        $select = $this->select();
        $select->order('id DESC');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function updateDataServices($title, $text1, $author_text, $text3, $author)
    {
        $data = array(
            'title' => $title,
            'text1' => $text1,
            'author_text' => $author_text,
            'text3' => $text3,
            'author' => $author
        );
        $this->update($data,'id= '.'1');
    }

}